package com.hx.test.hyl.repository;


import com.hx.test.hyl.domain.User;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

public class UserRepositoryMysqlPostfix implements UserCustom {

    @PersistenceContext(name = "entityManagerFactory")
    private EntityManager em;

    @Override
    public User findByUserId(String id) {
        System.out.println("Repository ...");
        Query query = this.em.createNativeQuery("select * from t_user");
        query.getResultList().stream().forEach(user -> System.out.println(user));
        return this.em.find(User.class,id);
    }
}
